//
//  WCNetDemoViewController.m
//  ZZNetWorker_Example
//
//  Created by ZengLiZhi on 2024/2/1.
//  Copyright © 2024 zenglizhi. All rights reserved.
//

#import "WCNetDemoViewController.h"
#import "ZZNetWorker.h"
#import "WCLoginModel.h"
#import "WCNetWorkParamHandler.h"

@interface WCNetDemoViewController ()

@end

@implementation WCNetDemoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [ZZNetWorker woker].baseUrl = @"https://dev-common-mb.botsmart.net/api/";
    [ZZNetWorker woker].paramHandler = [[WCNetWorkParamHandler alloc] init];
    [ZZNetWorker woker].responseClass = NSClassFromString(@"WCNetWorkResponse");
    
    //上报
    ZZNetWorker.POST.zz_url(@"app/bootstrap")
        .zz_param(@{})
        .zz_completion(^(ZZNetWorkResponse * _Nonnull response, NSError * _Nullable error) {
            
        });
//    return;
    
    //登录接口
    ZZNetWorker.POST
        .zz_url(@"auth/login")
        .zz_param(@{@"phone":@"13500001111",@"smsCode":@"666666",@"loginChannel":@"APP",@"loginType":@"1"})
        .zz_dataClass(WCLoginModel.class)
//        .zz_testResponse(@{@"code":@"200",@"data":@{@"token":@"token123456"}})
    .zz_completion(^(ZZNetWorkResponse<WCLoginModel *> * _Nonnull response, NSError * _Nonnull error) {
        self.textLabel.text = response.obj.token;
        [ZZNetWorker woker].token = response.obj.token;
    });
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
